//
//  TestValidators.m
//  chibiORM
//
//  Created by Mario Montoya on 14/01/09.
//  Copyright 2009 El malabarista. All rights reserved.
//

#import <GHUnit/GHUnit.h>
#import "Validators.h"

@interface TestValidators : GHTestCase { }
@end

@implementation TestValidators

-(void) testNotEmpty {
	NSString *empty = @"";
	NSNumber *emptyNum = [NSNumber numberWithFloat:0.0];
	NSError *outError;
	NSNull *null = [NSNull null];
	NSNumber *emptyBool = [NSNumber numberWithBool:FALSE];
	
	GHAssertEquals([Validators validateNotEmpty: &emptyNum propName:@"" error :&outError],NO,nil);
	GHAssertEquals([Validators validateNotEmpty: &empty propName:@"" error :&outError],NO,nil);
	GHAssertEquals([Validators validateNotEmpty: &emptyBool propName:@"" error :&outError],NO,nil);
	GHAssertEquals([Validators validateNotEmpty: &null propName:@"" error :&outError],NO,nil);
}

-(void) testCompareDate {
	NSError *outError;
    NSDate *dateOne = [NSDate date];
	[NSThread sleepForTimeInterval:3.0];
	NSDate *dateTwo = [NSDate date];
	
	GHAssertEquals([Validators validateCompareDate:NSOrderedSame propName:@"" dateOne:dateOne dateTwo:dateOne error:&outError],YES,nil);
	GHAssertEquals([Validators validateCompareDate:NSOrderedAscending propName:@"" dateOne:dateOne dateTwo:dateTwo error:&outError],YES,nil);
	GHAssertEquals([Validators validateCompareDate:NSOrderedDescending propName:@"" dateOne:dateTwo dateTwo:dateOne error:&outError],YES,nil);
}

@end
